package com.tn.openrpc.stomp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.kaazing.gateway.client.protocol.stomp.StompEvent;
import com.kaazing.gateway.client.protocol.stomp.StompListener;

/**
 * An implementation of <code>StompListener</code> that logs all events at a <i>debug</i> level.
 */
public class LoggingStompListener implements StompListener
{
  private static final Logger LOGGER = LoggerFactory.getLogger(LoggingStompListener.class);

  /**
   * {@inheritDoc}
   */
  @Override
  public void onOpen(StompEvent stompEvent)
  {
    LOGGER.debug("OPEN: {}", stompEvent.getHeaders());
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void onMessage(StompEvent stompEvent)
  {
    LOGGER.debug("MESSAGE: {}", stompEvent.getHeaders());
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void onReceipt(StompEvent stompEvent)
  {
    LOGGER.debug("RECEIPT: {}", stompEvent.getHeaders());
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void onClose(StompEvent stompEvent)
  {
    LOGGER.debug("CLOSE: {}", stompEvent.getHeaders());
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void onError(StompEvent stompEvent)
  {
    LOGGER.debug("ERROR: {}", stompEvent.getHeaders());
  }
}
